import request from '@/request/request'

// BOM管理相关接口
export const bomApi = {
  // 分页查询BOM列表
  list: (params) => request.get('/produce/bom/list', { params }),
  
  // 根据ID查询BOM详情
  getDetail: (id) => request.get(`/produce/bom/detail/${id}`),
  
  // 新增BOM
  add: (data) => request.post('/produce/bom/add', data),
  
  // 更新BOM
  update: (data) => request.put('/produce/bom/update', data),
  
  // 删除BOM
  delete: (id) => request.delete(`/produce/bom/delete/${id}`),
  
  // 获取产品列表
  getProducts: () => request.get('/produce/bom/products'),
  
  // 根据产品ID查询BOM列表
  getBomsByProduct: (productId) => request.get(`/produce/bom/byProduct/${productId}`),
  
  // 批量删除BOM
  batchDelete: (ids) => request.delete('/produce/bom/batchDelete', { data: ids }),
  
  // 复制BOM
  copy: (id, data) => request.post(`/produce/bom/copy/${id}`, data),
  
  // 启用/禁用BOM
  toggleStatus: (id) => request.put(`/produce/bom/toggleStatus/${id}`)
}
